package com.baidu.mapapi;

public class c
{
  private static char[] a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".toCharArray();
  private static byte[] b = new byte[256];

  static
  {
    for (int i = 0; i < 256; ++i)
      b[i] = -1;
    for (int j = 65; j <= 90; ++j)
      b[j] = (byte)(j - 65);
    for (int k = 97; k <= 122; ++k)
      b[k] = (byte)(k + 26 - 97);
    for (int l = 48; l <= 57; ++l)
      b[l] = (byte)(l + 52 - 48);
    b[43] = 62;
    b[47] = 63;
  }

  public static char[] a(char[] paramArrayOfChar)
  {
    int k;
    int l;
    char[] arrayOfChar1 = new char[4 * (2 + paramArrayOfChar.length) / 3];
    int i = 0;
    int j = 0;
    if (j < paramArrayOfChar.length)
    {
      k = (0xFF & paramArrayOfChar[j]) << '\b';
      if (j + 1 >= paramArrayOfChar.length)
        break label232;
      k |= 0xFF & paramArrayOfChar[(j + 1)];
      l = 1;
    }
    while (true)
    {
      int i2;
      int i1 = k << 8;
      if (j + 2 < paramArrayOfChar.length)
      {
        i1 |= 0xFF & paramArrayOfChar[(j + 2)];
        i2 = 1;
      }
      while (true)
      {
        int i4;
        int i5;
        int i6;
        char[] arrayOfChar3;
        int i7;
        int i3 = i + 3;
        char[] arrayOfChar2 = a;
        if (i2 != 0)
        {
          i4 = i1 & 0x3F;
          arrayOfChar1[i3] = arrayOfChar2[i4];
          i5 = i1 >> 6;
          i6 = i + 2;
          arrayOfChar3 = a;
          if (l == 0)
            break label217;
          i7 = i5 & 0x3F;
        }
        while (true)
        {
          while (true)
          {
            while (true)
            {
              arrayOfChar1[i6] = arrayOfChar3[i7];
              int i8 = i5 >> 6;
              arrayOfChar1[(i + 1)] = a[(i8 & 0x3F)];
              int i9 = i8 >> 6;
              arrayOfChar1[(i + 0)] = a[(i9 & 0x3F)];
              j += 3;
              i += 4;
            }
            i4 = 64;
          }
          label217: i7 = 64;
        }
        return arrayOfChar1;
        i2 = 0;
      }
      label232: l = 0;
    }
  }

  public static char[] b(char[] paramArrayOfChar)
  {
    int i = 0;
    int j = 3 * (3 + paramArrayOfChar.length) / 4;
    if ((paramArrayOfChar.length > 0) && (paramArrayOfChar[(paramArrayOfChar.length - 1)] == '='))
      --j;
    if ((paramArrayOfChar.length > 1) && (paramArrayOfChar[(paramArrayOfChar.length - 2)] == '='))
      --j;
    char[] arrayOfChar = new char[j];
    int k = 0;
    int l = 0;
    int i1 = 0;
    while (k < paramArrayOfChar.length)
    {
      int i2 = b[(0xFF & paramArrayOfChar[k])];
      if (i2 >= 0)
      {
        int i3 = i << 6;
        i1 += 6;
        i = i3 | i2;
        if (i1 >= 8)
        {
          i1 -= 8;
          int i4 = l + 1;
          arrayOfChar[l] = (char)(0xFF & i >> i1);
          l = i4;
        }
      }
      ++k;
    }
    if (l != arrayOfChar.length)
      throw new Error("miscalculated data length!");
    return arrayOfChar;
  }
}